<div class="layui-fluid" id="VIEW-list-table" lay-title="客户查询统计">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">筛选数据</div>
                <div class="layui-card-body">
                    <form class="layui-form" lay-filter="lig-customerET-searchform">
                        <div class="layui-inline">
                                <label class="layui-form-label" style="width:85px;">起止时间</label>
                                <div class="layui-inline">
                                    <input type="text" name="startTime" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-inline">--</div>
                                <div class="layui-inline">
                                    <input type="text" name="endTime" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        <div class="layui-inline">
                            <input type="button" class="layui-btn layui-btn-sm" lay-filter="lig-customerET-search" lig-lang="btn-search" value="查询">
                            <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary" lig-lang="btn-reset">重置</button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-body">
                    <table lay-filter="lig-customerET-table"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="tpl-customerET-table-row-toolBar">
    <a class="" lay-event="lig-total" lay-data="{{d.userId}}">{{d.total}}</a>
</script>
<script>
    var event_detail_user = {};
    layui.use(['admin', 'table', 'form', 'laydate', 'laytpl', 'jquery','lig'], function (admin, table, form, laydate, laytpl, $, lig) {
        var _searchForm = '[lay-filter="lig-customerET-searchform"]';
        laydate.render({
            elem: _searchForm + ' input[name="startTime"]'
        });
        laydate.render({
            elem: _searchForm + ' input[name="endTime"]'
        });
        $(_searchForm + ' input[name="startTime"]').val(lig.getNextDate(-1));
        $(_searchForm + ' input[name="endTime"]').val(lig.getDateNow());
        form.render();

        lig.table({
            elem: '[lay-filter="lig-customerET-table"]',
            url: 'bu/statistic/customer-et',
            cols: [[
                { title: '业务员', field: 'userName', width: '50%' },
                { title: '查询次数', field: 'total', width: '50%', toolbar: '#tpl-customerET-table-row-toolBar' }

            ]],
            page: false
        },{
            mode:'dialog',
            entity: 'customerET',
            primaryField: 'id',
            addContent: '',
            addUrl: '',
            addTitle: '',
            area: ['50%', 'auto'],
            onAddOpened: function() {
            },

            modifyContent: '',
            modifyUrl: '',
            modifyTitle: '',
            area: ['50%', 'auto'],
            onModifyOpened: function() {
            },

            removeUrl: '',
            getUrl: '',
            onTool: function(obj) {
                console.log(obj);
                //selectedTenantId = obj.data.tenantId;
                event_detail_user.id = obj.data.userId;
                event_detail_user.starTime = $(_searchForm + ' input[name="startTime"]').val();
                event_detail_user.endTime = $(_searchForm + ' input[name="endTime"]').val();
                if (obj.event == 'lig-total') {
                    admin.popup({
                        title: '<span>客户查询明细</span>',
                        url: 'bu/customer_event_detail',
                        area:['80%', '80%'],
                        success: function () {
                        }
                    });
                }
            }
        });

    })
</script>